package com.cloudptt.api.models;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

public class VersionInfo {

	private int versionCode = 0;
	private String name = "";
	private String url = "";
	private boolean must = false;
	private List<String> infos = null;



	public VersionInfo()
	{
	}
	
	public VersionInfo(String name,int versionCode)
	{
		this.name = name;
		this.versionCode = versionCode;
	}

	public int getVersionCode() {
		return versionCode;
	}

	public void setVersionCode(int versionCode) {
		this.versionCode = versionCode;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
	public boolean isMust() {
		return must;
	}

	public void setMust(String mustStr) {
		if(mustStr != null
				&& mustStr.equals("1"))
		{
			must = true;
		}
		else
		{
			must = false;
		}
	}
	public void addInfo(String info)
	{
		if(infos == null)
		{
			infos = new Vector<String>();
		}
		infos.add(info);
	}
	public List<String> getInfos() {
		return infos;
	}

	public String toString()
	{
		StringBuffer strBuff = new StringBuffer("VersionInfo:");
		strBuff.append("versionCode = ").append(versionCode).append(",");
		strBuff.append("name = ").append(name).append(",");
		strBuff.append("url = ").append(url).append(",");
		strBuff.append("must = ").append(must).append(",");
		if(infos != null)
		{
			for(Iterator<String> itor = infos.iterator();itor.hasNext();)
			{
				strBuff.append("info = ").append(itor.next()).append(",");
			}
		}
		else
		{
			strBuff.append("infos = null").append(";");
		}
		return strBuff.toString();
	}
}
